*** Selection Bias in Certiorari Decisions ***

/* TABLE 2 */
*** Heckman Probit Model
heckprob granted i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart amicuscert explitapp ///
  grouppet localpet statepet uspet ///
  if term>=1969, sel(petition= i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart explitapp unpublished postsmith ///
  kosher sabbath benefits righttopray criminal practice ///
  sense discrimination military) vce(robust) ///
  difficult technique(dfp nr)
**

*** Goodness of Fit
gen PREDICTIONS=.
est store heckmodel
predict pet_phat if e(sample), psel
predict gra_phat if e(sample), pcond
gen petition_hat=.
replace petition_hat=0 if pet_phat<0.5 & e(sample)
replace petition_hat=1 if pet_phat>=0.5 & e(sample) & pet_phat!=.
gen granted_chat=.
replace granted_hat=0 if gra_phat<0.5 & e(sample)
replace granted_hat=1 if gra_phat>=0.5 & e(sample) & gra_cphat!=.
tab petition petition_hat if e(sample)
di 409/578 /* PMC=.70761246 */
di (391+24)/578 /* PCP=.71799308 */
di (.71799308-.70761246)/(1-.70761246) /* PRE=.03550295 */
tab granted granted_chat if e(sample)
di 146/169 /* PMC=.86390533 */
di 146/169 /* PCP=.86390533 */
di (.86390533-.86390533)/(1-.86390533) /* PRE=0 */


/* TABLE 3 */
*** Test between heckprob and probit for granted

probit granted i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart amicuscert explitapp ///
  grouppet localpet statepet uspet ///
  if term>=1969
est store gra_probit

heckprob granted i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart amicuscert explitapp ///
  grouppet localpet statepet uspet ///
  if term>=1969, sel(petition= i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart explitapp unpublished postsmith ///
  kosher sabbath benefits righttopray criminal practice ///
  sense discrimination military) difficult technique(dfp nr)
est store heck_norobust

suest gra_probit heck_norobust
test [gra_probit_granted=heck_norobust_granted], cons

/* Wald chi2(16)= 204.46; p= 0.0000 */


/* Model comparisons discussed in footnote 14 (p. 64) */

*** Compare criminal-only model to civil-only model (petition)
probit petition i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart explitapp unpublished postsmith ///
  kosher sabbath benefits righttopray practice ///
  sense discrimination military if term>=1969 & criminal==0
est store pet_crim00

probit petition i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart explitapp unpublished postsmith ///
  kosher sabbath benefits righttopray practice ///
  sense discrimination military if term>=1969 & criminal==1
est store pet_crim01

hausman pet_crim1 pet_crim0

/*
                 ---- Coefficients ----
             |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
             |   pet_crim1    pet_crim0      Difference          S.E.
-------------+----------------------------------------------------------------
   1.libdec2 |   -.8552389     .1624125       -1.017651        1.431473
  1.libpanel |    .4431447     .2151068        .2280379        .9880778
1.libdec2#~l |    2.744401    -.2349017        2.979302         4.29437
 ideodistABS |    3.836237     1.389987        2.446249        2.188027
1.libdec2#~S |    25.58889    -.8601206        26.44901        16.79135
1.libpanel~S |   -3.229676    -.6522368       -2.577439        3.200269
1.libdec2#~S |   -31.19936    -.7064902       -30.49287        19.81651
     dissent |   -1.033029     .4089978       -1.442027        .8460614
  amicuspart |    .5933471     .2256003        .3677468         .499331
   explitapp |   -.4690439    -.0303136       -.4387303        .5957922
 unpublished |    .4305369    -.4850591         .915596        .8113767
   postsmith |   -.9906179    -.2885088        -.702109        .4716466
       sense |   -.1718415    -.2670528        .0952113        .4731986
discrimina~n |    .1761738    -.1555067        .3316805        .7944006
    military |   -.5034724    -.0273968       -.4760756        .3535989
------------------------------------------------------------------------------
                          b = consistent under Ho and Ha; obtained from probit
           B = inconsistent under Ha, efficient under Ho; obtained from probit

    Test:  Ho:  difference in coefficients not systematic

                 chi2(15) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                          =       11.77
                Prob>chi2 =      0.6962
*/

*** Compare criminal-only model to civil-only model (grant)
*** Using OLS (Linear Probability Model)
reg granted i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart amicuscert explitapp ///
  grouppet localpet statepet uspet ///
  if term>=1969 & criminal==0
est store gra_crim0_ols

reg granted i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart amicuscert explitapp ///
  grouppet localpet statepet uspet ///
  if term>=1969 & criminal==1
est store gra_crim1_ols

hausman gra_crim1_ols gra_crim0_ols
/*

                 ---- Coefficients ----
             |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
             |  gra_crim1_~s gra_crim0_~s    Difference          S.E.
-------------+----------------------------------------------------------------
   1.libdec2 |    .0477802    -.1724281        .2202083        .3143377
  1.libpanel |    .2348187    -.1526155        .3874342        .1943294
1.libdec2#~l |   -.2562159     .2186312        -.474847        .3636056
 ideodistABS |   -.0066106    -.1677172        .1611066        .4243506
1.libpanel~S |   -.1012128     .4819211       -.5831339        .5618699
     dissent |   -.0158068     .0652965       -.0811033        .2550829
  amicuspart |    .0031209     .1190315       -.1159106        .1210413
   explitapp |   -.1866976     -.059459       -.1272387        .1504795
    grouppet |   -.0499751    -.0636654        .0136903        .0822381
    statepet |     .140587     .1948858       -.0542988        .3966618
------------------------------------------------------------------------------
                         b = consistent under Ho and Ha; obtained from regress
          B = inconsistent under Ha, efficient under Ho; obtained from regress

    Test:  Ho:  difference in coefficients not systematic

                 chi2(10) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                          =       10.94
                Prob>chi2 =      0.3622
                (V_b-V_B is not positive definite)

*/

*** Compare criminal-only model, civil-only model, and full model (petition)
probit petition i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart explitapp unpublished postsmith ///
  kosher sabbath benefits righttopray practice ///
  sense discrimination military if term>=1969 & criminal==0
est store pet_crim00

probit petition i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart explitapp unpublished postsmith ///
  kosher sabbath benefits righttopray practice ///
  sense discrimination military if term>=1969 & criminal==1
est store pet_crim01

probit petition i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart explitapp unpublished postsmith ///
  kosher sabbath benefits righttopray practice ///
  sense discrimination military if term>=1969
est store pet_full

hausman pet_crim01 pet_full
/*
. hausman pet_crim01 pet_full

                 ---- Coefficients ----
             |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
             |   pet_crim01    pet_full      Difference          S.E.
-------------+----------------------------------------------------------------
   1.libdec2 |   -.8552389     .0723544       -.9275933        1.435978
  1.libpanel |    .4431447      .211535        .2316097        .9939771
1.libdec2#~l |    2.744401    -.1914584        2.935859        4.296891
 ideodistABS |    3.836237     1.461246        2.374991         2.20258
1.libdec2#~S |    25.58889    -.6739339        26.26282        16.79537
1.libpanel~S |   -3.229676    -.8383305       -2.391345         3.21615
1.libdec2#~S |   -31.19936     -.796647       -30.40272        19.82218
     dissent |   -1.033029     .3227121       -1.355741        .8485129
  amicuspart |    .5933471     .2293639        .3639832        .5032957
   explitapp |   -.4690439    -.0031545       -.4658895        .5981755
 unpublished |    .4305369    -.4534621        .8839989        .8132645
   postsmith |   -.9906179    -.3611375       -.6294803        .4740826
       sense |   -.1718415    -.2691789        .0973374        .4788831
discrimina~n |    .1761738    -.1394053        .3155792        .7963283
    military |   -.5034724    -.0899929       -.4134795        .4541543
------------------------------------------------------------------------------
                          b = consistent under Ho and Ha; obtained from probit
           B = inconsistent under Ha, efficient under Ho; obtained from probit

    Test:  Ho:  difference in coefficients not systematic

                 chi2(15) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                          =        7.91
                Prob>chi2 =      0.9274

*/

hausman pet_crim00 pet_full
/*
. hausman pet_crim00 pet_full

                 ---- Coefficients ----
             |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
             |   pet_crim00    pet_full      Difference          S.E.
-------------+----------------------------------------------------------------
   1.libdec2 |    .1624125     .0723544        .0900581         .113661
  1.libpanel |    .2151068      .211535        .0035718        .1081332
1.libdec2#~l |   -.2349017    -.1914584       -.0434433        .1471825
 ideodistABS |    1.389987     1.461246       -.0712584        .2527746
1.libdec2#~S |   -.8601206    -.6739339       -.1861868         .367368
1.libpanel~S |   -.6522368    -.8383305        .1860937        .3192213
1.libdec2#~S |   -.7064902     -.796647        .0901568         .473933
     dissent |    .4089978     .3227121        .0862857        .0644534
  amicuspart |    .2256003     .2293639       -.0037635        .0630484
   explitapp |   -.0303136    -.0031545       -.0271592        .0533437
 unpublished |   -.4850591    -.4534621        -.031597        .0553813
   postsmith |   -.2885088    -.3611375        .0726287         .047998
      kosher |   -.3855835     -.393452        .0078685        .0422667
     sabbath |   -.4774233    -.2555938       -.2218295        .2442355
    benefits |   -.3887403    -.3659982       -.0227422        .0675863
 righttopray |   -.5709254    -.5740229        .0030975        .0495074
    practice |   -.3603756     -.363853        .0034774        .0525657
       sense |   -.2670528    -.2691789        .0021261         .073567
discrimina~n |   -.1555067    -.1394053       -.0161013        .0553755
    military |   -.0273968    -.0899929        .0625961        .2849982
------------------------------------------------------------------------------
                          b = consistent under Ho and Ha; obtained from probit
           B = inconsistent under Ha, efficient under Ho; obtained from probit

    Test:  Ho:  difference in coefficients not systematic

                 chi2(20) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                          =       11.36
                Prob>chi2 =      0.9364
                (V_b-V_B is not positive definite)
*/


*** Compare criminal-only model, civil-only model, and full model (grant)

reg granted i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart amicuscert explitapp ///
  grouppet localpet statepet uspet ///
  if term>=1969 & criminal==0
est store gra_crim00_ols

reg granted i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart amicuscert explitapp ///
  grouppet localpet statepet uspet ///
  if term>=1969 & criminal==1
est store gra_crim01_ols

reg granted i.libdec2##i.libpanel##c.ideodistABS ///
  dissent amicuspart amicuscert explitapp ///
  grouppet localpet statepet uspet ///
  if term>=1969
est store gra_full_ols

hausman gra_crim01_ols gra_full_ols, sigmamore
/*
. hausman gra_crim01_ols gra_full_ols, sigmamore

                 ---- Coefficients ----
             |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
             |  gra_crim01~s gra_full_ols    Difference          S.E.
-------------+----------------------------------------------------------------
   1.libdec2 |    .0477802    -.1741613        .2219415        .5300603
  1.libpanel |    .2348187    -.0941682         .328987         .338539
1.libdec2#~l |   -.2562159     .1840268       -.4402426        .6292802
 ideodistABS |   -.0066106    -.1481648        .1415542        .7333153
1.libpanel~S |   -.1012128     .4134554       -.5146682        .9827819
     dissent |   -.0158068     .0542315       -.0700383        .3922762
  amicuspart |    .0031209      .089709       -.0865881        .2054628
   explitapp |   -.1866976    -.0509984       -.1356993         .242155
    grouppet |   -.0499751    -.0500537        .0000786        .1494909
    statepet |     .140587     .2052357       -.0646487        .6084873
------------------------------------------------------------------------------
                         b = consistent under Ho and Ha; obtained from regress
          B = inconsistent under Ha, efficient under Ho; obtained from regress

    Test:  Ho:  difference in coefficients not systematic

                 chi2(10) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                          =        2.54
                Prob>chi2 =      0.9903
*/

hausman gra_crim00_ols gra_full_ols, sigmamore
/*
. hausman gra_crim00_ols gra_full_ols, sigmamore

Note: the rank of the differenced variance matrix (11) does not equal the number of coefficients
        being tested (15); be sure this is what you expect, or there may be problems computing the
        test.  Examine the output of your estimators for anything unexpected and possibly consider
        scaling your variables so that the coefficients are on a similar scale.

                 ---- Coefficients ----
             |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
             |  gra_crim00~s gra_full_ols    Difference          S.E.
-------------+----------------------------------------------------------------
   1.libdec2 |   -.1724281    -.1741613        .0017332        .0820398
  1.libpanel |   -.1526155    -.0941682       -.0584472        .0574445
1.libdec2#~l |    .2186312     .1840268        .0346044        .0816404
 ideodistABS |   -.1677172    -.1481648       -.0195524        .1073095
1.libdec2#~S |    .7172539     .7500926       -.0328387        .2053172
1.libpanel~S |    .4819211     .4134554        .0684657        .1560733
1.libdec2#~S |   -.8982318    -.8769863       -.0212456        .2529304
     dissent |    .0652965     .0542315         .011065        .0239221
  amicuspart |    .1190315      .089709        .0293226        .0328887
  amicuscert |    .3815694     .3850345        -.003465        .0137746
   explitapp |    -.059459    -.0509984       -.0084606        .0280972
    grouppet |   -.0636654    -.0500537       -.0136117        .0284874
    localpet |    .1320906     .1486655       -.0165749        .0328354
    statepet |    .1948858     .2052357       -.0103499        .0344533
       uspet |    .2056291     .2208859       -.0152567        .0339542
------------------------------------------------------------------------------
                         b = consistent under Ho and Ha; obtained from regress
          B = inconsistent under Ha, efficient under Ho; obtained from regress

    Test:  Ho:  difference in coefficients not systematic

                 chi2(11) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                          =        3.17
                Prob>chi2 =      0.9883
                (V_b-V_B is not positive definite)
*/
